<template>
	<view class="view">
		<mp-html class="content" :content="data.infoDetail || data.content"></mp-html>
	</view>
</template>

<script>
	import {
		noticeDetail
	} from '@/apis/request.js'

	export default {
		data() {
			return {
				type: '',
				id: '',
				data: {}
			};
		},
		onLoad(options) {
			this.id = options.id || '';
			this.type = options.type || '';
			this.init();
		},
		methods: {
			init() {
				if (this.id) {
					noticeDetail({
						id: this.id
					}).then(res => {
						this.data = res;
						uni.setNavigationBarTitle({
							title: this.data.title || '详情'
						});
					})
				} else {
					this.$api.http('/notice/smsInfoDetail/api/n/list', 'GET', {
						type: this.type
					}, res => {
						this.data = res.data.result;
						uni.setNavigationBarTitle({
							title: this.data.infoTitle || '详情'
						});
					})
				}
			},
			sign () {
				uni.navigateTo({
					url: '/pages/other/signature/signature'
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	.content {
		padding: 30rpx;
		background-color: #FFFFFF;
	}
</style>